package cn.kgc.ffzw.day17;

public abstract class Pet extends Object {

    String name;
    int  helath;
    int love;

    public  Pet(){}

    public Pet(String name, int helath, int love) {
        this.name = name;
        this.helath = helath;
        this.love = love;
    }

    public void print(){
        System.out.println("姓名为："+name+",健康值："+helath+"请密度为："+love);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHelath() {
        return helath;
    }

    public void setHelath(int helath) {
        this.helath = helath;
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        this.love = love;
    }


    @Override
    public boolean equals(Object obj) {
        if ((obj == null) || this == null) {
            return false;
        }
        if (obj instanceof Pet) {
            Pet newpet = (Pet) obj;
            if (this.name.equals(newpet.name)) {
                return true;
            }

        }
        return false;
    }
    public  abstract void eat();


}
